package com.loyal.loyalerp.model;

import java.lang.reflect.Field;

import com.loyal.loyalerp.basedata.company.model.GyCompany;
import com.loyal.loyalerp.humenresource.role.model.GyRole;

public class GyUserRole {

	private Integer id;
    
    private Integer companyid;
    
    private Integer roleid;
    
    private Integer userid;

    private GyUser user;
    
    private GyRole role;
    
    private GyCompany company;

    
	public GyCompany getCompany() {
		return company;
	}

	public void setCompany(GyCompany company) {
		this.company = company;
	}

	public GyUserRole(Integer companyid, Integer roleid, Integer userid) {
		this.companyid = companyid;
		this.roleid = roleid;
		this.userid = userid;
	}

	public GyUserRole(Integer id, Integer companyid, Integer roleid, Integer userid, GyUser user, GyRole role) {
		super();
		this.id = id;
		this.companyid = companyid;
		this.roleid = roleid;
		this.userid = userid;
		this.user = user;
		this.role = role;
	}
	
	public GyUserRole() {
	}

	public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getCompanyid() {
        return companyid;
    }

    public void setCompanyid(Integer companyid) {
        this.companyid = companyid;
    }

	public GyUser getUser() {
		return user;
	}

	public void setUser(GyUser user) {
		this.user = user;
	}

	public GyRole getRole() {
		return role;
	}

	public void setRole(GyRole role) {
		this.role = role;
	}

	public Integer getRoleid() {
		return roleid;
	}

	public void setRoleid(Integer roleid) {
		this.roleid = roleid;
	}

	public Integer getUserid() {
		return userid;
	}

	public void setUserid(Integer userid) {
		this.userid = userid;
	}
    
	 /**
     * 判断类中的属性值是否为空
     * @param obj
     * @return
     * @throws IllegalArgumentException
     * @throws IllegalAccessException
     */
    public boolean checkObjFieldIsNull(Object obj) throws IllegalArgumentException, IllegalAccessException {
    	boolean flag = false;
    	for(Field f : obj.getClass().getDeclaredFields()) {
    		f.setAccessible(true);
    		if(f.get(obj) == null) {
    			flag = true;
    			return flag;
    		}
    	}
    	return flag;
    }
}